package com.wnxy.consumer.listener;

import com.wnxy.sddfp.common.result.Result;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

@Component
public class ConsumerListener {

    @RabbitListener(queues = "msg.queue")
    public void sendEmail(String msg) {
        System.out.println("msg = " + msg);
    }


    @RabbitListener(queues = "obj.queue")
    public void getObj(@Payload Result result) {
        System.out.println("result = " + result);
    }

    @RabbitListener(queues = "simple.queue")
    public void getSimpleQueue(String msg) {
        System.out.println("result = " + msg);
    }

    @RabbitListener(queues = "work.queue")
    public void getWorkQueue1(String msg) {
        System.out.println("getWorkQueue1 = " + msg);
    }

    @RabbitListener(queues = "work.queue")
    public void getWorkQueue2(String msg) {
        System.out.println("getWorkQueue2 = " + msg);
    }

    @RabbitListener(queues = "fanout.queue1")
    public void getFanoutQueue1(String msg) {
        System.out.println("getFanoutQueue1 = " + msg);
    }

    @RabbitListener(queues = "fanout.queue2")
    public void getFanoutQueue2(String msg) {
        System.out.println("getFanoutQueue2 = " + msg);
    }

    @RabbitListener(queues = "direct.queue1")
    public void getDirectQueue1(String msg) {
        System.out.println("getDirectQueue1 = " + msg);
    }

    @RabbitListener(queues = "direct.queue2")
    public void getDirectQueue2(String msg) {
        System.out.println("getDirectQueue2 = " + msg);
    }

    @RabbitListener(queues = "topic.queue1")
    public void getTopicQueue1(String msg) {
        System.out.println("getTopicQueue1 = " + msg);
    }

    @RabbitListener(queues = "topic.queue2")
    public void getTopicQueue2(String msg) {
        System.out.println("getTopicQueue2 = " + msg);
    }

}
